<%--
  Created by IntelliJ IDEA.
  User: sofwin
  Date: 2021/7/13
  Time: 16:34
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%String path = request.getContextPath()+"/";%>
<!doctype html>
<html>
<head>
    <base href="<%=path%>">
    <title>编辑用户信息</title>
    <script type="text/javascript" src="bootstrap/js/jquery.min.js"></script>
    <link href="bootstrap/ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet">
    <script type="text/javascript" src="bootstrap/ztree/js/jquery.ztree.core.js"></script>
    <script type="text/javascript" src="bootstrap/ztree/js/jquery.ztree.excheck.js"></script>

    <script type="text/javascript" src="bootstrap/js/plugins/layer/layer.min.js"></script>
    <script type="text/javascript" src="bootstrap/js/ry.js"></script>
    <style>
    input{
        width:60%;
    }
</style>
</head>
<body>
<div id="tree" class="ztree"></div>
</body>
<script>
   var zTreeObj;
    // zTree 的参数配置，深入使用请参考 API 文档（setting 配置详解）
    var setting = {
        data:{
            simpleData:{
                enable:true
            }
        },
        check:{
            enable:true,
            chkStyle:'radio'
        },
        callback:{
            onCheck:function(e,treeId,node){
                if(node.checked){
                    parent.$("#showName").val(node.name);
                    parent.$("#parentId").val(node.id);
                   parent.layer.close(parent.index);
                }
            }
        }
    };
    // zTree 的数据属性，深入使用请参考 API 文档（zTreeNode 节点数据详解）

    $(document).ready(function(){
        $.modal.post("dept/treeData","",function (ret) {
            if(ret.code==200){
                zTreeObj = $.fn.zTree.init($("#tree"), setting, ret.data);
            }
        });
//  能够监听到单选框被选中的事件     当前单选框对应的节点也可以获取
        // id name
        // parent.$("#parentId").val(id)
        // parent.$("#name").val(name);
        // 弹出层关掉
    });
</script>
</html>
